﻿using System;

namespace SimpleFactoryPatterDemo
{
    /// <summary>
    /// 具体的产品实现角色 : 除法操作类
    /// </summary>
    public class DivOperation : Operation
    {
        /// <summary>
        /// 具体实现产品角色：--->拿到其对应产品结果
        /// </summary>
        /// <returns></returns>
        public override double GetResult()
        {
            if (0 == NumberB)
            {
                throw new DivideByZeroException();
            }

            return NumberA / NumberB;
        }
    }
}